import re

line = 'Vlanif1          192.168.11.11/24     up         up'
match=re.search('(\S+)\s+([\w.]+)',line)
#(\S+) 匹配非空字符
#([\w.]+)  匹配数字或字母或点

print(match.group(0))
print(match.group(1))
print(match.group(2))
print(match.group(1,2))

print(match.group(1,2,1))

match1=re.search('(?P<interface>\S+)\s+(?P<ipaddress>[\w].+)/',line)
print(match1)

print(match1.group('interface'))
print(match1.group('ipaddress'))

print(match1.groupdict())
# 通过groupdict来实现字典化
